const handleTransformSql = (sql, dbName) => {
  debugger;
  const sqlArr = sql.split(' ').filter((v) => !!v);
  console.log(sqlArr);
  let index = Infinity;
  return sqlArr
    .map((v, i) => {
      if (v === 'from') {
        console.log(v, '--');
        index = i;
      }
      if (index + 1 == i) {
        return `${dbName}.${v}`;
      }

      return v;
    })
    .join(' ');
};

let res = handleTransformSql('select   * from    flaw limit 1', 'ddd');
console.log(res);
